<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>半透明边框</title>
  <style>
    body {
      height: 100vh;
      background-color: black;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .box {
      background-color: white;
      height: 100px;
      margin-top: 20px;
      width: 400px;
      border: 10px solid hsla(0, 0%, 100%, .5);
    }

    input#check:checked ~ div {
      background-clip: padding-box;
    }



    
  </style>
</head>
<body>
  <div id="app">
    <input type="checkbox" id="check" checked><label for="check">padding-box(默认)</label>
    <div class="box"></div>
  </div>
</body>
</html>